connect(_ui->stopExistingFolderNowBigSyncCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->moveFilesToTrashCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
- connect(_ui->remotePollIntervalSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &GeneralSettings::slotRemotePollIntervalChanged);
- connect(_ui->remotePollIntervalCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotRemotePollIntervalCheckBoxToggled);
+ connect(_ui->remotePollIntervalSpinBox, &QSpinBox::valueChanged, this, &GeneralSettings::slotRemotePollIntervalChanged);
#ifndef WITH_CRASHREPORTER
_ui->crashreporterCheckBox->setVisible(false);
#endif
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
-
- bool hasCustomInterval = cfgFile.hasRemotePollInterval();
- _ui->remotePollIntervalCheckBox->setChecked(hasCustomInterval);
+ ;
auto interval = cfgFile.remotePollInterval();
_ui->remotePollIntervalSpinBox->setValue(static_cast<int>(interval.count() / 1000));
- _ui->remotePollIntervalSpinBox->setEnabled(hasCustomInterval);
}
#if defined(BUILD_UPDATER)
#endif
}
-void GeneralSettings::slotRemotePollIntervalCheckBoxToggled(bool checked) {
- _ui->remotePollIntervalSpinBox->setEnabled(checked); // Enable/disable the spin box
-
- ConfigFile cfgFile;
-
- if (checked) {
- slotRemotePollIntervalChanged(_ui->remotePollIntervalSpinBox->value());
- } else {
- // Reset to default interval when unchecked
- cfgFile.resetRemotePollInterval();
-
- // Update the spinbox with the default value
- auto interval = cfgFile.remotePollInterval();
- _ui->remotePollIntervalSpinBox->setValue(static_cast<int>(interval.count() / 1000));
- }
-}
void GeneralSettings::slotRemotePollIntervalChanged(int seconds) {
- if (_currentlyLoading) return;
-
- if (_ui->remotePollIntervalCheckBox->isChecked()) {
- ConfigFile cfgFile;
- std::chrono::milliseconds interval(seconds * 1000);
- cfgFile.setRemotePollInterval(interval);
+ if (_currentlyLoading) {
+ return;
}
+
+ ConfigFile cfgFile;
+ std::chrono::milliseconds interval(seconds * 1000);
+ cfgFile.setRemotePollInterval(interval);
}
} // namespace OCC
</widget>
</item>
</layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_trash">
+ <item>
+ <widget class="QCheckBox" name="moveFilesToTrashCheckBox">
+ <property name="text">
+ <string>Move removed files to trash</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_remotePollInterval">
<item>
- <widget class="QCheckBox" name="remotePollIntervalCheckBox">
+ <widget class="QLabel" name="remotePollIntervalLabel">
<property name="text">
<string>Server poll interval</string>
</property>
<number>30</number>
</property>
<property name="maximum">
- <number>3600</number>
+ <number>999999</number>
</property>
<property name="singleStep">
<number>1</number>
</item>
</layout>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_trash">
- <item>
- <widget class="QCheckBox" name="moveFilesToTrashCheckBox">
- <property name="text">
- <string>Move removed files to trash</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
_discoveredLegacyConfigPath = discoveredLegacyConfigPath;
}
-bool ConfigFile::hasRemotePollInterval(const QString &connection) const
-{
- QString con(connection);
- if (connection.isEmpty())
- con = defaultConnection();
-
- QSettings settings(configFile(), QSettings::IniFormat);
- settings.beginGroup(con);
-
- return settings.contains(QLatin1String(remotePollIntervalC));
-}
-
-void ConfigFile::resetRemotePollInterval(const QString &connection) {
- QString con(connection);
- if (connection.isEmpty())
- con = defaultConnection();
-
- std::chrono::milliseconds defaultInterval(DEFAULT_REMOTE_POLL_INTERVAL);
- setRemotePollInterval(defaultInterval, con); // Use existing method
-}
-
}